package Test;

public class ReverseStringinRecur {
    public static void main(String[] args) {
        String[] str = {"A", "B", "C", "D", "E"};
        reverse(str[0], 0, str);
    }

    private static void reverse(String str, int index, String[] s) {
        if (s[s.length - 1].equals(str)) {
            System.out.print(s[index] + " ");
        } else {
            reverse(s[index + 1], index + 1, s);
            System.out.print(s[index] + " ");
        }
    }
}
